home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
10,000 Great Games
/
10,000 Great Games.iso
/
Product
/
66
/
data1.cab
/
Source_Files
/
Src
/
TurretDlg.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2000-01-16
|
2KB
|
73 lines
#include "stdafx.h"
#include "TurretDlg.h"
CTurretDlg::CTurretDlg(cTurret *_turret, CWnd* pParent)
: CDialog(CTurretDlg::IDD, pParent)
{
turret = _turret;
//{{AFX_DATA_INIT(CTurretDlg)
m_Armor = 0;
m_From = 0;
m_To = 0;
//}}AFX_DATA_INIT
m_From = turret->rotation_start * 360 / 256;
m_To = turret->rotation_end * 360 / 256;
m_Armor = turret->armor;
}
void CTurretDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTurretDlg)
DDX_Control(pDX, IDC_TURRET_DELAY, m_Delay);
DDX_Control(pDX, IDC_TURRET_ROTATION, m_Rotation);
DDX_Text(pDX, IDC_TURRET_ARMOR, m_Armor);
DDV_MinMaxInt(pDX, m_Armor, 1, 1000);
DDX_Text(pDX, IDC_TURRET_FROM, m_From);
DDV_MinMaxInt(pDX, m_From, -360, 360);
DDX_Text(pDX, IDC_TURRET_TO, m_To);
DDV_MinMaxInt(pDX, m_To, -360, 360);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTurretDlg, CDialog)
//{{AFX_MSG_MAP(CTurretDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CTurretDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_Delay.SetRange(sec / 10, 5 * sec);
m_Delay.SetPos(turret->fire_delay);
m_Rotation.SetRange(0, 80);
m_Rotation.SetPos(turret->rotation_speed);
return TRUE;
}
void CTurretDlg::OnOK()
{
UpdateData();
turret->fire_delay = m_Delay.GetPos();
turret->rotation_speed = m_Rotation.GetPos();
turret->rotation_start = (fix)m_From * 256 / 360;
turret->rotation_end = (fix)m_To * 256 / 360;
turret->armor = m_Armor;
turret->set_rotation_angle(turret->rotation_start);
turret->make_dirty();
CDialog::OnOK();
}